package com.example.testandroid;

import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshListView;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

public class MainActivity extends FragmentActivity {
	private PullToRefreshListView mListView;
	private ArrayAdapter<String> mAdapter;

	protected void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		setContentView(R.layout.test1);
		mListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
		ListView actualListView =  mListView.getRefreshableView();
		
		mListView.setOnRefreshListener(new OnRefreshListener<ListView>() {

			public void onRefresh(PullToRefreshBase<ListView> refreshView) {
				refreshView.getLoadingLayoutProxy().setLastUpdatedLabel("nihao tangjian");

			}
		});
		mAdapter = new ArrayAdapter<String>(getApplicationContext(),
				android.R.layout.simple_list_item_1,
				new String[] { "cds", "cdsac", "egasd", "cdsc" });
		actualListView.addHeaderView(this.getLayoutInflater().inflate(R.layout.test, null));
		actualListView.setAdapter(mAdapter);
	}

}